﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimUDuck
{
   public abstract class Duck   //抽象类基类
    {
      public   IFlyBehavior iFlyBehavior;  //接口变量 代表两种行为  叫声，飞行
      public   IQuackBehavior iQuackBehavior;
        public ISingBehavior iSingBehavior;
        public void Swim()    //有用动作一样
        { 
            Console.WriteLine("划水让我快乐");
        }
        public abstract  void Display(); //显示信息 ，每个都不同

        public void PerFormQuack()   //叫声
        {
            iQuackBehavior.Quack();
        }
        public void PerFormFly()  //飞行
        {
            iFlyBehavior.Fly();
        }
        public void PerFormSing()   //唱歌
        {
            iSingBehavior.Sing();
        }
        public void setFlyBehavior(IFlyBehavior fb)     //飞行变量
        {
            iFlyBehavior = fb;
        }
        public void setQuackBehavior(IQuackBehavior qb)
        {
            iQuackBehavior = qb;

        }
    }

   
}
